<template>
<div>
  <h1>登录页面</h1>
  <p>账号：<input type="text" v-model="form.username"></p>
  <p>密码：<input type="text" v-model="form.password"></p>
  <button @click="denglu">登录</button>
</div>
</template>

<script>
export default {
  name: "login",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    denglu(){
      this.$axios.post('users/denlu',this.form).then(res=>{
        if(res.data.code==200){
          alert(res.data.mes)
          localStorage.setItem('userid',res.data.userid)
          this.$router.go(-1)
        }
        else {
          alert(res.data.mes)
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
